import request from '@/utils/request'

export function getPage(data) {
  return request({
    url: `/field/page?fieldName=${data.fieldName}&page=${data.page}&limit=${data.limit}`,
    method: 'get' // query
  })
}

export function getRegionPage(data) {
  return request({
    url: `/region/page?regionName=${data.regionName}`,
    method: 'get' // query
  })
}

export function addField(data) {
  return request({
    url: `/field/addField`,
    method: 'post',
    data: data // body
  })
}

export function updateField(data) {
  return request({
    url: `/field/updateField`,
    method: 'post',
    data: data
  })
}

export function deleteField(data) {
  return request({
    url: `/field/deleteField?fieldId=${data.fieldId}`,
    method: 'post'
  })
}

export function deleteFields(data) {
  return request({
    url: `/field/deleteFields?fieldIds=${data.item}`,
    method: 'post'
  })
}
